home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 16 / CU Amiga Magazine's Super CD-ROM 16 (1997-10-16)(EMAP Images)(GB)[!][issue 1997-11].iso / CUCD / Online / HBBS / Source / Node / NodeGUI / NodeGUI.c_ next >
Text File  |  1997-08-22  |  19KB  |  652 lines

  1. /*********************************************/
  2. /*                                           */
  3. /*       Designer (C) Ian OConnor 1994       */
  4. /*                                           */
  5. /*      Designer Produced C include file     */
  6. /*                                           */
  7. /*********************************************/
  8.  
  9.  
  10. #include <exec/types.h>
  11. #include <exec/memory.h>
  12. #include <dos/dosextens.h>
  13. #include <intuition/screens.h>
  14. #include <intuition/intuition.h>
  15. #include <intuition/gadgetclass.h>
  16. #include <libraries/gadtools.h>
  17. #include <diskfont/diskfont.h>
  18. #include <utility/utility.h>
  19. #include <graphics/gfxbase.h>
  20. #include <workbench/workbench.h>
  21. #include <graphics/scale.h>
  22. #include <clib/exec_protos.h>
  23. #include <clib/wb_protos.h>
  24. #include <clib/intuition_protos.h>
  25. #include <clib/gadtools_protos.h>
  26. #include <clib/graphics_protos.h>
  27. #include <clib/utility_protos.h>
  28. #include <string.h>
  29. #include <clib/diskfont_protos.h>
  30.  
  31. #include "NodeGUI.h"
  32.  
  33. #include "/common/types.h"
  34. #include "/common/defines.h"
  35. #include "/common/structures.h"
  36.  
  37. extern struct NodeData *N_ND;
  38.  
  39.  
  40.  
  41. ULONG BevelTags[] =
  42.   {
  43.   (GTBB_Recessed), TRUE,
  44.   (GT_VisualInfo), 0,
  45.   (TAG_DONE)
  46.   };
  47.  
  48. struct IntuiText NodeWndTexts[] =
  49.   {
  50.   1, 3, JAM1, 5, 3, &HBBS8066, (UBYTE *)"Name", &NodeWndTexts[1],
  51.   1, 3, JAM1, 165, 3, &HBBS8066, (UBYTE *)"Group", &NodeWndTexts[2],
  52.   1, 3, JAM1, 325, 3, &HBBS8066, (UBYTE *)"Action", &NodeWndTexts[3],
  53.   1, 3, JAM1, 557, 3, &HBBS8066, (UBYTE *)"CPS/BAUD", NULL
  54.   };
  55.  
  56. struct Window *NodeWnd = NULL;
  57. APTR NodeWndVisualInfo;
  58. APTR NodeWndDrawInfo;
  59. struct Gadget *NodeWndGList;
  60. struct Gadget *NodeWndGadgets[8];
  61. UBYTE NodeWndFirstRun = 0;
  62.  
  63. STRPTR NodeWnd_ChatFlagLabels[] =
  64. {
  65.   (STRPTR)"Chat ON",
  66.   (STRPTR)"Chat OFF",
  67.   NULL
  68. };
  69.  
  70. STRPTR NodeWnd_OffHookLabels[] =
  71. {
  72.   (STRPTR)"OnHook",
  73.   (STRPTR)"OffHook",
  74.   NULL
  75. };
  76.  
  77. STRPTR NodeWnd_ReserveLabels[] =
  78. {
  79.   (STRPTR)"UnReserved",
  80.   (STRPTR)"Reserved",
  81.   NULL
  82. };
  83.  
  84. ULONG NodeWndGadgetTags[] =
  85.   {
  86.   (GTCY_Labels), (ULONG)&NodeWnd_ChatFlagLabels[0],
  87.   (TAG_END),
  88.   (GTCY_Labels), (ULONG)&NodeWnd_OffHookLabels[0],
  89.   (TAG_END),
  90.   (GTCY_Labels), (ULONG)&NodeWnd_ReserveLabels[0],
  91.   (TAG_END),
  92.   };
  93.  
  94. UWORD NodeWndGadgetTypes[] =
  95.   {
  96.   BUTTON_KIND,
  97.   BUTTON_KIND,
  98.   BUTTON_KIND,
  99.   BUTTON_KIND,
  100.   BUTTON_KIND,
  101.   CYCLE_KIND,
  102.   CYCLE_KIND,
  103.   CYCLE_KIND,
  104.   };
  105.  
  106. struct NewGadget NodeWndNewGad[] =
  107.   {
  108.   311, 27, 87, 12, (UBYTE *)"Init Modem", &HBBS8066, NodeWnd_InitModem, 16, NULL,  NULL,
  109.   463, 27, 52, 12, (UBYTE *)"Chat", &HBBS8066, NodeWnd_ChatNow, 16, NULL,  NULL,
  110.   516, 27, 71, 12, (UBYTE *)"Settings", &HBBS8066, NodeWnd_Settings, 16, NULL,  NULL,
  111.   588, 27, 42, 12, (UBYTE *)"Info", &HBBS8066, NodeWnd_Information, 16, NULL,  NULL,
  112.   399, 27, 63, 12, (UBYTE *)"Watch", &HBBS8066, NodeWnd_Screen, 16, NULL,  NULL,
  113.   2, 27, 98, 12, NULL, &HBBS8066, NodeWnd_ChatFlag, 1, NULL,  (APTR)&NodeWndGadgetTags[0],
  114.   101, 27, 93, 12, NULL, &HBBS8066, NodeWnd_OffHook, 1, NULL,  (APTR)&NodeWndGadgetTags[3],
  115.   195, 27, 115, 12, NULL, &HBBS8066, NodeWnd_Reserve, 1, NULL,  (APTR)&NodeWndGadgetTags[6],
  116.   };
  117. UWORD NodeWndZoomInfo[4] = { 0, 11, 196, 11 };
  118.  
  119. struct Window *InfoWin = NULL;
  120. APTR InfoWinVisualInfo;
  121. APTR InfoWinDrawInfo;
  122. struct Gadget *InfoWinGList;
  123. struct Gadget *InfoWinGadgets[5];
  124. UBYTE InfoWinFirstRun = 0;
  125.  
  126. STRPTR InfoWin_LV1_Cycle1Labels[] =
  127. {
  128.   (STRPTR)"Callers",
  129.   (STRPTR)"Uploads",
  130.   (STRPTR)"Downloads",
  131.   (STRPTR)"Pagers",
  132.   (STRPTR)"PWFails",
  133.   (STRPTR)"Carrier Losses",
  134.   NULL
  135. };
  136.  
  137. ULONG InfoWinGadgetTags[] =
  138.   {
  139.   (GTCY_Labels), (ULONG)&InfoWin_LV1_Cycle1Labels[0],
  140.   (TAG_END),
  141.   (GTLV_Selected), 0,
  142.   (TAG_END),
  143.   (GTNM_Border), TRUE,
  144.   (TAG_END),
  145.   (GTNM_Border), TRUE,
  146.   (TAG_END),
  147.   (GTNM_Border), TRUE,
  148.   (TAG_END),
  149.   };
  150.  
  151. UWORD InfoWinGadgetTypes[] =
  152.   {
  153.   CYCLE_KIND,
  154.   LISTVIEW_KIND,
  155.   NUMBER_KIND,
  156.   NUMBER_KIND,
  157.   NUMBER_KIND,
  158.   };
  159.  
  160. struct NewGadget InfoWinNewGad[] =
  161.   {
  162.   10, 34, 237, 14, NULL, &HBBS8066, InfoWin_LV1_Cycle1, 1, NULL,  (APTR)&InfoWinGadgetTags[0],
  163.   10, 49, 236, 100, NULL, &HBBS8066, InfoWin_LV1, 1, NULL,  (APTR)&InfoWinGadgetTags[3],
  164.   63, 8, 45, 12, (UBYTE *)"Calls", &HBBS8066, InfoWin_Calls, 1, NULL,  (APTR)&InfoWinGadgetTags[6],
  165.   139, 8, 34, 12, (UBYTE *)"UL", &HBBS8066, InfoWin_Uploads, 1, NULL,  (APTR)&InfoWinGadgetTags[9],
  166.   208, 8, 34, 12, (UBYTE *)"DL", &HBBS8066, InfoWin_Downloads, 1, NULL,  (APTR)&InfoWinGadgetTags[12],
  167.   };
  168. UWORD InfoWinZoomInfo[4] = { 306, 153, 243, 18 };
  169.  
  170. struct IntuiText SettingsWinTexts[] =
  171.   {
  172.   2, 0, JAM2, 13, 4, &topa81281, (UBYTE *)"Screen/Window Settings", &SettingsWinTexts[1],
  173.   2, 0, JAM2, 13, 55, &topa81281, (UBYTE *)"Modem Settings", &SettingsWinTexts[2],
  174.   2, 0, JAM2, 13, 101, &HBBS8066, (UBYTE *)"Misc Settings", NULL
  175.   };
  176.  
  177. struct Window *SettingsWin = NULL;
  178. APTR SettingsWinVisualInfo;
  179. APTR SettingsWinDrawInfo;
  180. struct Gadget *SettingsWinGList;
  181. struct Gadget *SettingsWinGadgets[8];
  182. UBYTE SettingsWinFirstRun = 0;
  183.  
  184. STRPTR SettingsWin_WinOrScreenLabels[] =
  185. {
  186.   (STRPTR)"Use Screen",
  187.   (STRPTR)"Use Window",
  188.   NULL
  189. };
  190.  
  191. ULONG SettingsWinGadgetTags[] =
  192.   {
  193.   (GTCY_Labels), (ULONG)&SettingsWin_WinOrScreenLabels[0],
  194.   (TAG_END),
  195.   (GTCB_Checked), TRUE,
  196.   (TAG_END),
  197.   };
  198.  
  199. UWORD SettingsWinGadgetTypes[] =
  200.   {
  201.   BUTTON_KIND,
  202.   CYCLE_KIND,
  203.   CHECKBOX_KIND,
  204.   CHECKBOX_KIND,
  205.   CHECKBOX_KIND,
  206.   BUTTON_KIND,
  207.   BUTTON_KIND,
  208.   BUTTON_KIND,
  209.   };
  210.  
  211. struct NewGadget SettingsWinNewGad[] =
  212.   {
  213.   12, 15, 129, 12, (UBYTE *)"Pick Mode", &HBBS8066, SettingsWin_ScreenMode, 16, NULL,  NULL,
  214.   12, 30, 129, 12, NULL, &HBBS8066, SettingsWin_WinOrScreen, 2, NULL,  (APTR)&SettingsWinGadgetTags[0],
  215.   12, 65, 26, 11, (UBYTE *)"Modem Debug", &HBBS8066, SettingsWin_ModemDebug, 2, NULL,  NULL,
  216.   12, 77, 26, 11, (UBYTE *)"Modem Log", &HBBS8066, SettingsWin_ModemLog, 2, NULL,  NULL,
  217.   12, 111, 26, 11, (UBYTE *)"Allow Logins", &HBBS8066, SettingsWin_AllowLogins, 2, NULL,  (APTR)&SettingsWinGadgetTags[3],
  218.   143, 15, 129, 12, (UBYTE *)"Save Windows", &HBBS8066, SettingsWin_SaveWin, 16, NULL,  NULL,
  219.   143, 65, 129, 12, (UBYTE *)"Device Config", &HBBS8066, SettingsWin_DeviceConfig, 16, NULL,  NULL,
  220.   143, 111, 129, 12, (UBYTE *)"Node Config", &HBBS8066, SettingsWin_NodeConfig, 16, NULL,  NULL,
  221.   };
  222. UWORD SettingsWinZoomInfo[4] = { 200, 0, 200, 25 };
  223.  
  224. struct Library *DiskfontBase = NULL;
  225. struct Library *GadToolsBase = NULL;
  226. struct GfxBase *GfxBase = NULL;
  227. struct IntuitionBase *IntuitionBase = NULL;
  228. struct LocaleBase *LocaleBase = NULL;
  229.  
  230. APTR WaitPointer = NULL;
  231. UWORD WaitPointerData[] =
  232.     {
  233.     0x0000,0x0000,0x0400,0x07c0,
  234.     0x0000,0x07c0,0x0100,0x0380,
  235.     0x0000,0x07e0,0x07c0,0x1ff8,
  236.     0x1ff0,0x3fec,0x3ff8,0x7fde,
  237.     0x3ff8,0x7fbe,0x7ffc,0xff7f,
  238.     0x7ffc,0xffff,0x7ffc,0xffff,
  239.     0x3ff8,0x7ffe,0x3ff8,0x7ffe,
  240.     0x1ff0,0x3ffc,0x07c0,0x1ff8,
  241.     0x0000,0x07e0,0x0000,0x0000
  242.     };
  243.  
  244. struct TextAttr HBBS8066 = { (STRPTR)"HBBS.font", 8, 0, 66 };
  245. struct TextAttr topa81281 = { (STRPTR)"topaz", 8, 128, 1 };
  246.  
  247. void RendWindowNodeWnd( struct Window *Win, void *vi )
  248. {
  249. int loop;
  250. UWORD offx = Win->BorderLeft;
  251. UWORD offy = Win->BorderTop;
  252. if (Win != NULL)
  253.   {
  254.   BevelTags[3] = (ULONG)vi;
  255.   DrawBevelBoxA( Win->RPort, 1+offx,1+offy,629,12, (struct TagItem *)(&BevelTags[2]));
  256.   DrawBevelBoxA( Win->RPort, 1+offx,14+offy,629,12, (struct TagItem *)(&BevelTags[2]));
  257.   for( loop=0; loop<4; loop++)
  258.     if (NodeWndTexts[loop].ITextFont==NULL)
  259.       NodeWndTexts[loop].ITextFont=Win->WScreen->Font;
  260.   PrintIText( Win->RPort, NodeWndTexts, offx, offy);
  261.   }
  262. }
  263.  
  264. int OpenNodeWndWindow( struct Screen *Scr)
  265. {
  266. UWORD offx, offy;
  267. UWORD loop;
  268. struct NewGadget newgad;
  269. struct Gadget *Gad;
  270. struct Gadget *Gad2;
  271. APTR Cla;
  272. if (NodeWndFirstRun == 0)
  273.   {
  274.   NodeWndFirstRun = 1;
  275.   }
  276. if (NodeWnd == NULL)
  277.   {
  278.   offx = Scr->WBorLeft;
  279.   offy = Scr->WBorTop + Scr->Font->ta_YSize+1;
  280.   if (NULL != ( NodeWndVisualInfo = GetVisualInfoA( Scr, NULL)))
  281.     {
  282.     if (NULL != ( NodeWndDrawInfo = GetScreenDrawInfo( Scr)))
  283.       {
  284.       NodeWndGList = NULL;
  285.       Gad = CreateContext( &NodeWndGList);
  286.       for ( loop=0 ; loop<8 ; loop++ )
  287.         if (NodeWndGadgetTypes[loop] != 198)
  288.           {
  289.           CopyMem((char * )&NodeWndNewGad[loop], ( char * )&newgad, (long)sizeof( struct NewGadget ));
  290.           newgad.ng_VisualInfo = NodeWndVisualInfo;
  291.           newgad.ng_LeftEdge += offx;
  292.           newgad.ng_TopEdge += offy;
  293.           NodeWndGadgets[ loop ] = NULL;
  294.           NodeWndGadgets[ newgad.ng_GadgetID - NodeWndFirstID ] = Gad = CreateGadgetA( NodeWndGadgetTypes[loop], Gad, &newgad, newgad.ng_UserData );
  295.           }
  296.       for ( loop=0 ; loop<8 ; loop++ )
  297.         if (NodeWndGadgetTypes[loop] == 198)
  298.           {
  299.           NodeWndGadgets[ loop ] = NULL;
  300.           Cla = NULL;
  301.           if (Gad)
  302.             NodeWndGadgets[ loop ] = Gad2 = (struct Gadget *) NewObjectA( (struct IClass *)Cla, NodeWndNewGad[ loop ].ng_GadgetText, NodeWndNewGad[ loop ].ng_UserData );
  303.           }
  304.       if (Gad != NULL)
  305.         {
  306.         if (NULL != (NodeWnd = OpenWindowTags( NULL,
  307.                 (WA_Left), N_ND->NodeX,
  308.                 (WA_Top), N_ND->NodeY,
  309.                 (WA_Width), 636+offx,
  310.                 (WA_Height), 42+offy,
  311.                 (WA_Title), "",
  312.                 (WA_MinWidth), 200,
  313.                 (WA_MinHeight), 11,
  314.                 (WA_MaxWidth), 65534,
  315.                 (WA_MaxHeight), 65534,
  316.                 (WA_DragBar), TRUE,
  317.                 (WA_DepthGadget), TRUE,
  318.                 (WA_CloseGadget), TRUE,
  319.                 (WA_Activate), TRUE,
  320.                 (WA_Dummy+0x30), TRUE,
  321.                 (WA_SmartRefresh), TRUE,
  322.                 (WA_Gadgets), NodeWndGList,
  323.                 (WA_Zoom), NodeWndZoomInfo,
  324.                 (WA_PubScreen) , (LONG)Scr,
  325.                 (WA_IDCMP),2097732,
  326.                 (TAG_END))))
  327.           {
  328.           RendWindowNodeWnd(NodeWnd, NodeWndVisualInfo );
  329.           GT_RefreshWindow( NodeWnd, NULL);
  330.           RefreshGList( NodeWndGList, NodeWnd, NULL, ~0);
  331.           return( 0L );
  332.           }
  333.         }
  334.       FreeGadgets( NodeWndGList);
  335.       FreeScreenDrawInfo( Scr, NodeWndDrawInfo );
  336.       }
  337.     FreeVisualInfo( NodeWndVisualInfo );
  338.     }
  339.   }
  340. else
  341.   {
  342.   WindowToFront(NodeWnd);
  343.   ActivateWindow(NodeWnd);
  344.   return( 1L );
  345.   }
  346. return( 1L );
  347. }
  348.  
  349. void CloseNodeWndWindow( void )
  350. {
  351. if (NodeWnd != NULL)
  352.   {
  353.   FreeScreenDrawInfo( NodeWnd->WScreen, NodeWndDrawInfo );
  354.   NodeWndDrawInfo = NULL;
  355.   CloseWindow( NodeWnd);
  356.   NodeWnd = NULL;
  357.   FreeVisualInfo( NodeWndVisualInfo);
  358.   FreeGadgets( NodeWndGList);
  359.   }
  360. }
  361.  
  362. void RendWindowInfoWin( struct Window *Win, void *vi )
  363. {
  364. UWORD offx = Win->BorderLeft;
  365. UWORD offy = Win->BorderTop;
  366. if (Win != NULL)
  367.   {
  368.   BevelTags[3] = (ULONG)vi;
  369.   DrawBevelBoxA( Win->RPort, 10+offx,6+offy,236,16, (struct TagItem *)(&BevelTags[2]));
  370.   DrawBevelBoxA( Win->RPort, 2+offx,1+offy,252,26, (struct TagItem *)(&BevelTags[0]));
  371.   DrawBevelBoxA( Win->RPort,2+4+offx,1+2+offy,252-8,26-4, (struct TagItem *)(&BevelTags[2]));
  372.   DrawBevelBoxA( Win->RPort, 2+offx,29+offy,252,125, (struct TagItem *)(&BevelTags[0]));
  373.   DrawBevelBoxA( Win->RPort,2+4+offx,29+2+offy,252-8,125-4, (struct TagItem *)(&BevelTags[2]));
  374.   }
  375. }
  376.  
  377. int OpenInfoWinWindow( struct Screen *Scr)
  378. {
  379. UWORD offx, offy;
  380. UWORD loop;
  381. struct NewGadget newgad;
  382. struct Gadget *Gad;
  383. struct Gadget *Gad2;
  384. APTR Cla;
  385. if (InfoWinFirstRun == 0)
  386.   {
  387.   InfoWinFirstRun = 1;
  388.   }
  389. if (InfoWin == NULL)
  390.   {
  391.   offx = Scr->WBorLeft;
  392.   offy = Scr->WBorTop + Scr->Font->ta_YSize+1;
  393.   if (NULL != ( InfoWinVisualInfo = GetVisualInfoA( Scr, NULL)))
  394.     {
  395.     if (NULL != ( InfoWinDrawInfo = GetScreenDrawInfo( Scr)))
  396.       {
  397.       InfoWinGList = NULL;
  398.       Gad = CreateContext( &InfoWinGList);
  399.       for ( loop=0 ; loop<5 ; loop++ )
  400.         if (InfoWinGadgetTypes[loop] != 198)
  401.           {
  402.           CopyMem((char * )&InfoWinNewGad[loop], ( char * )&newgad, (long)sizeof( struct NewGadget ));
  403.           newgad.ng_VisualInfo = InfoWinVisualInfo;
  404.           newgad.ng_LeftEdge += offx;
  405.           newgad.ng_TopEdge += offy;
  406.           InfoWinGadgets[ loop ] = NULL;
  407.           InfoWinGadgets[ newgad.ng_GadgetID - InfoWinFirstID ] = Gad = CreateGadgetA( InfoWinGadgetTypes[loop], Gad, &newgad, newgad.ng_UserData );
  408.           }
  409.       for ( loop=0 ; loop<5 ; loop++ )
  410.         if (InfoWinGadgetTypes[loop] == 198)
  411.           {
  412.           InfoWinGadgets[ loop ] = NULL;
  413.           Cla = NULL;
  414.           if (Gad)
  415.             InfoWinGadgets[ loop ] = Gad2 = (struct Gadget *) NewObjectA( (struct IClass *)Cla, InfoWinNewGad[ loop ].ng_GadgetText, InfoWinNewGad[ loop ].ng_UserData );
  416.           }
  417.       if (Gad != NULL)
  418.         {
  419.         if (NULL != (InfoWin = OpenWindowTags( NULL, (WA_Left), 342,
  420.                 (WA_Top), 82,
  421.                 (WA_Width), 260+offx,
  422.                 (WA_Height), 158+offy,
  423.                 (WA_Title), "",
  424.                 (WA_MinWidth), 150,
  425.                 (WA_MinHeight), 25,
  426.                 (WA_MaxWidth), 1200,
  427.                 (WA_MaxHeight), 1200,
  428.                 (WA_DragBar), TRUE,
  429.                 (WA_DepthGadget), TRUE,
  430.                 (WA_CloseGadget), TRUE,
  431.                 (WA_Activate), TRUE,
  432.                 (WA_Dummy+0x30), TRUE,
  433.                 (WA_SmartRefresh), TRUE,
  434.                 (WA_Gadgets), InfoWinGList,
  435.                 (WA_Zoom), InfoWinZoomInfo,
  436.                 (WA_PubScreen) , (LONG)Scr,
  437.                 (WA_IDCMP),4194940,
  438.                 (TAG_END))))
  439.           {
  440.           RendWindowInfoWin(InfoWin, InfoWinVisualInfo );
  441.           GT_RefreshWindow( InfoWin, NULL);
  442.           RefreshGList( InfoWinGList, InfoWin, NULL, ~0);
  443.           return( 0L );
  444.           }
  445.         }
  446.       FreeGadgets( InfoWinGList);
  447.       FreeScreenDrawInfo( Scr, InfoWinDrawInfo );
  448.       }
  449.     FreeVisualInfo( InfoWinVisualInfo );
  450.     }
  451.   }
  452. else
  453.   {
  454.   WindowToFront(InfoWin);
  455.   ActivateWindow(InfoWin);
  456.   return( 0L );
  457.   }
  458. return( 1L );
  459. }
  460.  
  461. void CloseInfoWinWindow( void )
  462. {
  463. if (InfoWin != NULL)
  464.   {
  465.   FreeScreenDrawInfo( InfoWin->WScreen, InfoWinDrawInfo );
  466.   InfoWinDrawInfo = NULL;
  467.   CloseWindow( InfoWin);
  468.   InfoWin = NULL;
  469.   FreeVisualInfo( InfoWinVisualInfo);
  470.   FreeGadgets( InfoWinGList);
  471.   }
  472. }
  473.  
  474. void RendWindowSettingsWin( struct Window *Win, void *vi )
  475. {
  476. int loop;
  477. UWORD offx = Win->BorderLeft;
  478. UWORD offy = Win->BorderTop;
  479. if (Win != NULL)
  480.   {
  481.   BevelTags[3] = (ULONG)vi;
  482.   DrawBevelBoxA( Win->RPort, 2+offx,6+offy,280,44, (struct TagItem *)(&BevelTags[0]));
  483.   DrawBevelBoxA( Win->RPort,2+4+offx,6+2+offy,280-8,44-4, (struct TagItem *)(&BevelTags[2]));
  484.   DrawBevelBoxA( Win->RPort, 2+offx,57+offy,280,37, (struct TagItem *)(&BevelTags[0]));
  485.   DrawBevelBoxA( Win->RPort,2+4+offx,57+2+offy,280-8,37-4, (struct TagItem *)(&BevelTags[2]));
  486.   DrawBevelBoxA( Win->RPort, 2+offx,103+offy,280,27, (struct TagItem *)(&BevelTags[0]));
  487.   DrawBevelBoxA( Win->RPort,2+4+offx,103+2+offy,280-8,27-4, (struct TagItem *)(&BevelTags[2]));
  488.   for( loop=0; loop<3; loop++)
  489.     if (SettingsWinTexts[loop].ITextFont==NULL)
  490.       SettingsWinTexts[loop].ITextFont=Win->WScreen->Font;
  491.   PrintIText( Win->RPort, SettingsWinTexts, offx, offy);
  492.   }
  493. }
  494.  
  495. int OpenSettingsWinWindow( struct Screen *Scr)
  496. {
  497. UWORD offx, offy;
  498. UWORD loop;
  499. struct NewGadget newgad;
  500. struct Gadget *Gad;
  501. struct Gadget *Gad2;
  502. APTR Cla;
  503. if (SettingsWinFirstRun == 0)
  504.   {
  505.   SettingsWinFirstRun = 1;
  506.   }
  507. if (SettingsWin == NULL)
  508.   {
  509.   offx = Scr->WBorLeft;
  510.   offy = Scr->WBorTop + Scr->Font->ta_YSize+1;
  511.   if (NULL != ( SettingsWinVisualInfo = GetVisualInfoA( Scr, NULL)))
  512.     {
  513.     if (NULL != ( SettingsWinDrawInfo = GetScreenDrawInfo( Scr)))
  514.       {
  515.       SettingsWinGList = NULL;
  516.       Gad = CreateContext( &SettingsWinGList);
  517.       for ( loop=0 ; loop<8 ; loop++ )
  518.         if (SettingsWinGadgetTypes[loop] != 198)
  519.           {
  520.           CopyMem((char * )&SettingsWinNewGad[loop], ( char * )&newgad, (long)sizeof( struct NewGadget ));
  521.           newgad.ng_VisualInfo = SettingsWinVisualInfo;
  522.           newgad.ng_LeftEdge += offx;
  523.           newgad.ng_TopEdge += offy;
  524.           SettingsWinGadgets[ loop ] = NULL;
  525.           SettingsWinGadgets[ newgad.ng_GadgetID - SettingsWinFirstID ] = Gad = CreateGadgetA( SettingsWinGadgetTypes[loop], Gad, &newgad, newgad.ng_UserData );
  526.           }
  527.       for ( loop=0 ; loop<8 ; loop++ )
  528.         if (SettingsWinGadgetTypes[loop] == 198)
  529.           {
  530.           SettingsWinGadgets[ loop ] = NULL;
  531.           Cla = NULL;
  532.           if (Gad)
  533.             SettingsWinGadgets[ loop ] = Gad2 = (struct Gadget *) NewObjectA( (struct IClass *)Cla, SettingsWinNewGad[ loop ].ng_GadgetText, SettingsWinNewGad[ loop ].ng_UserData );
  534.           }
  535.       if (Gad != NULL)
  536.         {
  537.         if (NULL != (SettingsWin = OpenWindowTags( NULL, (WA_Left), 153,
  538.                 (WA_Top), 34,
  539.                 (WA_Width), 289+offx,
  540.                 (WA_Height), 134+offy,
  541.                 (WA_Title), "",
  542.                 (WA_MinWidth), 100,
  543.                 (WA_MinHeight), 25,
  544.                 (WA_MaxWidth), 1200,
  545.                 (WA_MaxHeight), 1200,
  546.                 (WA_DragBar), TRUE,
  547.                 (WA_DepthGadget), TRUE,
  548.                 (WA_CloseGadget), TRUE,
  549.                 (WA_Activate), TRUE,
  550.                 (WA_Dummy+0x30), TRUE,
  551.                 (WA_SmartRefresh), TRUE,
  552.                 (WA_AutoAdjust), TRUE,
  553.                 (WA_Gadgets), SettingsWinGList,
  554.                 (WA_Zoom), SettingsWinZoomInfo,
  555.                 (WA_PubScreen) , (LONG)Scr,
  556.                 (WA_IDCMP),580,
  557.                 (TAG_END))))
  558.           {
  559.           RendWindowSettingsWin(SettingsWin, SettingsWinVisualInfo );
  560.           GT_RefreshWindow( SettingsWin, NULL);
  561.           RefreshGList( SettingsWinGList, SettingsWin, NULL, ~0);
  562.           return( 0L );
  563.           }
  564.         }
  565.       FreeGadgets( SettingsWinGList);
  566.       FreeScreenDrawInfo( Scr, SettingsWinDrawInfo );
  567.       }
  568.     FreeVisualInfo( SettingsWinVisualInfo );
  569.     }
  570.   }
  571. else
  572.   {
  573.   WindowToFront(SettingsWin);
  574.   ActivateWindow(SettingsWin);
  575.   return( 0L );
  576.   }
  577. return( 1L );
  578. }
  579.  
  580. void CloseSettingsWinWindow( void )
  581. {
  582. if (SettingsWin != NULL)
  583.   {
  584.   FreeScreenDrawInfo( SettingsWin->WScreen, SettingsWinDrawInfo );
  585.   SettingsWinDrawInfo = NULL;
  586.   CloseWindow( SettingsWin);
  587.   SettingsWin = NULL;
  588.   FreeVisualInfo( SettingsWinVisualInfo);
  589.   FreeGadgets( SettingsWinGList);
  590.   }
  591. }
  592.  
  593. int OpenLibs( void )
  594. {
  595. LocaleBase = (struct LocaleBase * )OpenLibrary((UBYTE *)"locale.library", 38);
  596. if ( NULL != (DiskfontBase = OpenLibrary((UBYTE *)"diskfont.library" , 36)))
  597.   if ( NULL != (GadToolsBase = OpenLibrary((UBYTE *)"gadtools.library" , 37)))
  598.     if ( NULL != (GfxBase = (struct GfxBase * )OpenLibrary((UBYTE *)"graphics.library" , 37)))
  599.       if ( NULL != (IntuitionBase = (struct IntuitionBase * )OpenLibrary((UBYTE *)"intuition.library" , 37)))
  600.         return( 0L );
  601. CloseLibs();
  602. return( 1L );
  603. }
  604.  
  605. void CloseLibs( void )
  606. {
  607. if (NULL != DiskfontBase )
  608.   CloseLibrary( DiskfontBase );
  609. if (NULL != GadToolsBase )
  610.   CloseLibrary( GadToolsBase );
  611. if (NULL != GfxBase )
  612.   CloseLibrary( ( struct Library * )GfxBase );
  613. if (NULL != IntuitionBase )
  614.   CloseLibrary( ( struct Library * )IntuitionBase );
  615. if (NULL != LocaleBase )
  616.   CloseLibrary( ( struct Library * )LocaleBase );
  617. }
  618.  
  619. int OpenDiskFonts( void )
  620. {
  621.   int OKSoFar = 0;
  622. if (NULL == OpenDiskFont( &HBBS8066 ) )
  623.   OKSoFar = 1;
  624. if (NULL == OpenDiskFont( &topa81281 ) )
  625.   OKSoFar = 1;
  626. return ( OKSoFar );
  627. }
  628.  
  629. int MakeImages( void )
  630. {
  631. UWORD failed = 0;
  632. if (NULL != (WaitPointer=AllocMem( 72, MEMF_CHIP)))
  633.   CopyMem( WaitPointerData, WaitPointer, 72);
  634. else
  635.   failed = 1;
  636. if (failed==0)
  637.   return( 0L );
  638. else
  639.   {
  640.   FreeImages();
  641.   return( 1L );
  642.   }
  643. }
  644.  
  645. void FreeImages( void )
  646. {
  647. if (WaitPointer != NULL)
  648.   FreeMem( WaitPointer, 72);
  649. WaitPointer = NULL;
  650. }
  651.  
  652.